<template>
    <div class="edituser">
        <el-link type="primary" @click="backMan">返回首页</el-link>
        <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign" ref="formLabelAlign">
        <el-form-item label="用户名称">
        <el-input v-model="formLabelAlign.user_name"></el-input>
        </el-form-item>
        <el-form-item label="用户密码">
        <el-input v-model="formLabelAlign.user_password"></el-input>
        </el-form-item>
        <el-form-item label="用户手机">
        <el-input v-model="formLabelAlign.user_phone"></el-input>
        </el-form-item>
        <el-form-item label="用户邮箱">
        <el-input v-model="formLabelAlign.user_email"></el-input>
        </el-form-item>
        <el-form-item>
        <el-button type="primary" @click="submitForm">修改</el-button>
        <el-button @click="resetForm('formLabelAlign')">重置</el-button>
        </el-form-item>
        </el-form>
    </div>
</template>
<script>
  export default {
    data() {
      return {
        labelPosition: 'right',
        formLabelAlign: {
          // user_id:this.$route.params.user_id,
          // user_name: this.$route.params.user_name,
          // user_password:this.$route.params.user_password,
          // user_phone: this.$route.params.user_phone,
          // user_email:this.$route.params.user_email
          user_id:1,
          user_name:"hunter",
          user_password:"123456",
          user_phone:"15227356265",
          user_email:"1633699204@qq.com"
        }
      };
    },
    methods:{
        backMan(){
          this.$router.push('/manage');
        },
         resetForm(formName) {
            this.$refs[formName].resetFields();
        },
        submitForm(){
            this.axios.post("/api/shopping/modifyUser.php",this.formLabelAlign).then(res=>{
                if(res.data=="ok"){
                    this.$message({
                        type:'success',
                        message:'修改成功'
                    });
                }else{
                    this.$message({
                        type:'success',
                        message:'服务器繁忙'
                    });
                }
            });
        }
    }
  }
</script>
<style>
  .edituser{
    width: 100%;
    height: 800px;
    background-color: rgba(255, 255, 255, 0.8);
  }
</style>